<%@ page import="website.Apartment" %>



<div class="fieldcontain ${hasErrors(bean: apartmentInstance, field: 'name', 'error')} ">
	<label for="name">
		<g:message code="apartment.name.label" default="Name" />
		
	</label>
	<g:textField name="name" maxlength="50" value="${apartmentInstance?.name}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: apartmentInstance, field: 'descript', 'error')} ">
	<label for="descript">
		<g:message code="apartment.descript.label" default="Descript" />
		
	</label>
	<g:textField name="descript" value="${apartmentInstance?.descript}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: apartmentInstance, field: 'dim', 'error')} required">
	<label for="dim">
		<g:message code="apartment.dim.label" default="Dim" />
		<span class="required-indicator">*</span>
	</label>
	<g:field type="number" name="dim" required="" value="${fieldValue(bean: apartmentInstance, field: 'dim')}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: apartmentInstance, field: 'floor', 'error')} required">
	<label for="floor">
		<g:message code="apartment.floor.label" default="Floor" />
		<span class="required-indicator">*</span>
	</label>
	<g:field type="number" name="floor" required="" value="${fieldValue(bean: apartmentInstance, field: 'floor')}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: apartmentInstance, field: 'location', 'error')} ">
	<label for="location">
		<g:message code="apartment.location.label" default="Location" />
		
	</label>
	<g:textField name="location" value="${apartmentInstance?.location}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: apartmentInstance, field: 'max_people', 'error')} required">
	<label for="max_people">
		<g:message code="apartment.max_people.label" default="Maxpeople" />
		<span class="required-indicator">*</span>
	</label>
	<g:field type="number" name="max_people" required="" value="${fieldValue(bean: apartmentInstance, field: 'max_people')}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: apartmentInstance, field: 'min_people', 'error')} required">
	<label for="min_people">
		<g:message code="apartment.min_people.label" default="Minpeople" />
		<span class="required-indicator">*</span>
	</label>
	<g:field type="number" name="min_people" required="" value="${fieldValue(bean: apartmentInstance, field: 'min_people')}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: apartmentInstance, field: 'pricelist', 'error')} required">
	<label for="pricelist">
		<g:message code="apartment.pricelist.label" default="Pricelist" />
		<span class="required-indicator">*</span>
	</label>
	<g:select id="pricelist" name="pricelist.id" from="${website.Price.list()}" optionKey="id" required="" value="${apartmentInstance?.pricelist?.id}" class="many-to-one"/>
</div>

<div class="fieldcontain ${hasErrors(bean: apartmentInstance, field: 'reservations', 'error')} ">
	<label for="reservations">
		<g:message code="apartment.reservations.label" default="Reservations" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${apartmentInstance?.reservations?}" var="r">
    <li><g:link controller="reservation" action="show" id="${r.id}">${r?.encodeAsHTML()}</g:link></li>
</g:each>
<li class="add">
<g:link controller="reservation" action="create" params="['apartment.id': apartmentInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'reservation.label', default: 'Reservation')])}</g:link>
</li>
</ul>

</div>

<div class="fieldcontain ${hasErrors(bean: apartmentInstance, field: 'reviews', 'error')} ">
	<label for="reviews">
		<g:message code="apartment.reviews.label" default="Reviews" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${apartmentInstance?.reviews?}" var="r">
    <li><g:link controller="review" action="show" id="${r.id}">${r?.encodeAsHTML()}</g:link></li>
</g:each>
<li class="add">
<g:link controller="review" action="create" params="['apartment.id': apartmentInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'review.label', default: 'Review')])}</g:link>
</li>
</ul>

</div>

